package com.sinodata.ns.cell;

import jt.classic.system.AbstractIBigObject;
import jt.classic.system.group.IGroup;

import java.util.List;
import java.util.Map;


/**
 * 监理标段信息
 *
 * @author mido
 *
 */
public class JLBDInfo extends AbstractIBigObject {
    private CellInfo bd;
    private String bdname = "";
    private IGroup group;

    public IGroup igroup() {
        return this.group;
    }

    /**
     * 设计单元
     * @return CellInfo
     */
    public CellInfo icell() {
        return this.bd;
    }

    public String ibdname() {
        return this.bdname;
    }

    public void reload(Map map) {
        if (map != null) {
            this.info = map;

            this.bigoid = (String) this.info.get("ID");
            this.bigoname = (String) this.info.get("SVBD_NAME");
            this.group = (IGroup) this.info.get("GROUP");

            this.bd = (CellInfo) this.info.get("CELLINFO");

            if (this.bd != null) {
                this.bdname = this.bd.iname();

                List list = this.bd.ibd();

                if ((list != null) && !list.isEmpty()) {
                    this.bdname += " : ";

                    for (int i = 0; i < list.size(); i++) {
                        CellBDInfo cbi = (CellBDInfo) list.get(i);

                        if (i < (list.size() - 1)) {
                            this.bdname += (cbi.iname() + ",");
                        } else {
                            this.bdname += cbi.iname();
                        }
                    }
                }
            }
        }
    }
}
